<!DOCTYPE html>
<!-- saved from url=(0052)http://getbootstrap.com/docs/4.0/examples/dashboard/ -->
<html lang="en" xmlns:th="http://www.thymeleaf.org">

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta name="description" content="">
    <meta name="author" content="">

    <title>Dashboard Template for Bootstrap</title>
    <!-- Bootstrap core CSS -->
    <link th:href="@{/css/bootstrap.min.css}" rel="stylesheet">

    <!-- Custom styles for this template -->
    <link th:href="@{/css/dashboard.css}" rel="stylesheet">
    <style type="text/css">

        @-webkit-keyframes chartjs-render-animation {
            from {
                opacity: 0.99
            }
            to {
                opacity: 1
            }
        }

        @keyframes chartjs-render-animation {
            from {
                opacity: 0.99
            }
            to {
                opacity: 1
            }
        }

        .chartjs-render-monitor {
            -webkit-animation: chartjs-render-animation 0.001s;
            animation: chartjs-render-animation 0.001s;
        }
    </style>
</head>

<body>
<div th:replace="~{common/commonsUser::topbar}"></div>

<div class="container-fluid">
    <div class="row">
        <div th:replace="~{common/commonsUser::sidebar(active='findEmpList.html')}"></div>

        <main role="main" class="col-md-9 ml-sm-auto col-lg-10 pt-3 px-4">
            <h2>员工管理</h2>
            <form th:action="@{/findEmp}" method="post">
                <table>
                    <tr>
                        <th>
                            <div class="form-group">
                                <label for="InputName">姓名</label>
                                <input name="employeename" type="text" class="" id="InputName" placeholder="张三">
                            </div>
                        </th>
                        <th>
                            <div class="form-group">
                                <label for="InputIdcard">身份证号</label>
                                <input name="idcard" type="text" class="" id="InputIdcard" placeholder="33900519981222XXXX">
                            </div>
                        </th>
                        <th>
                            <div class="form-group">
                                <label >性别</label>
                                <div class="form-check form-check-inline" >
                                    <input class="form-check-input" type="radio" name="sex"  value="1">
                                    <label class="form-check-label">男</label>
                                </div>
                                <div class="form-check form-check-inline" >
                                    <input class="form-check-input" type="radio" name="sex"  value="2">
                                    <label class="form-check-label">女</label>
                                </div>
                            </div>
                        </th>
                        <th>
                            <div class="form-group">
                                <label for="InputAge">年龄</label>
                                <input name="age" type="text" class="" id="InputAge" placeholder="25">
                            </div>
                        </th>
                        <th>
                            <div class="form-group">
                                <label for="InputTelephone">电话</label>
                                <input name="telephone" type="text" class="" id="InputTelephone" placeholder="138****1234">
                            </div>
                        </th>
                    </tr>
                    <tr>
                        <th>
                            <div class="form-group">
                                <label for="InputAddress">地址</label>
                                <input name="address" type="text" class="" id="InputAddress" placeholder="浙江省杭州市临安区青山湖街道杭电路1号">
                            </div>
                        </th>
                        <th>
                            <div class="form-group">
                                <label for="InputEmail1">邮箱</label>
                                <input name="email" type="text" class="" id="InputEmail1" placeholder="123@123.com">
                            </div>
                        </th>
                        <th>
                            <div class="form-group">
                                <label>部门</label>
                                <!--提交的是部门的ID-->
                                <select class="" name="departmentname">
                                    <option value="">请选择</option>
                                    <option  th:each="dept:${departments}" th:text="${dept.departmentname}" th:value="${dept.departmentname}">1</option>
                                </select>
                            </div>
                        </th>
                        <th>
                            <div class="form-group">
                                <label for="InputPosition">职位</label>
                                <input name="position" type="text" class="" id="InputPosition" placeholder="员工">
                            </div>
                        </th>
                        <th>
                            <div class="form-group">
                                <label>入职日期</label>
                                <input name="date" type="text"  class="" id="dateFormat" autocomplete="off">
                            </div>
                        </th>
                    </tr>
                </table>
                <button type="submit" class="btn btn-primary">查询员工</button>
            </form>

            <hr size="1" noshade="noshade" style="border:1px #cccccc dotted;">

            <button id="download" class="btn btn-primary" onclick="excel()">打印员工</button>

            <div class="table-responsive">
                <table class="table table-striped table-sm" id="table">
                    <thead>
                    <tr>
                        <th>序号</th>
                        <th>职工姓名</th>
                        <th>身份证号</th>
                        <th>性别</th>
                        <th>年龄</th>
                        <th>联系电话</th>
                        <th>地址</th>
                        <th>邮箱</th>
                        <th>部门</th>
                        <th>职位</th>
                        <th>入职日期</th>
                    </tr>
                    </thead>
                    <tbody>
                    <tr th:each="emp:${emps}">
                        <td th:text="${emp.getId()}"></td>
                        <td th:text="${emp.getEmployeename()}"></td>
                        <td th:text="${emp.getIdcard()}"></td>
                        <td th:text="${emp.getSex() == 1 ? '男':'女'}"></td>
                        <td th:text="${emp.getAge()}"></td>
                        <td th:text="${emp.getTelephone()}"></td>
                        <td th:text="${emp.getAddress()}"></td>
                        <td th:text="${emp.getEmail()}"></td>
                        <td th:text="${emp.getDepartmentname()}"></td>
                        <td th:text="${emp.getPosition()}"></td>
                        <!--使用时间格式化工具-->
                        <td th:text="${#dates.format(emp.getDate(),'yyyy-MM-dd')}"></td>
                    </tr>

                    </tbody>
                </table>
            </div>
        </main>
    </div>
</div>
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script type="text/javascript" th:src="@{/js/jquery-3.2.1.slim.min.js}"></script>
<script type="text/javascript" th:src="@{/js/popper.min.js}"></script>
<script type="text/javascript" th:src="@{/js/bootstrap.min.js}"></script>
<script type="text/javascript" th:src="@{/laydate/laydate.js}"></script>
<script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.5.1/jquery.js"></script>
<script type="text/javascript" th:src="@{/js/jquery.table2excel.js}"></script>
<script>
    //执行一个laydate实例
    laydate.render({
        elem: '#dateFormat',
        trigger:'click'//指定元素
    });
</script>
<script>
    function excel(){
        //.tableexcel是需要导出table的class
        $("#table").table2excel({
            //需要导出的列
            columns:[0,1,2,3,4],
            // 导出的Excel文档的名称
            name: "员工信息表",
            // Excel文件的名称
            filename: "员工信息表",
            // 是否导出图片
            exclude_img: true,
            // 是否导出超链接
            exclude_links: true,
            // 是否导出输入框中的内容
            exclude_inputs: true,
        });
    }
</script>
</body>
</html>